package com.weitu.environmental.basicInfo.service.impl;

import com.weitu.environmental.basicInfo.entity.Device;
import com.weitu.environmental.basicInfo.mapper.DeviceMapper;
import com.weitu.environmental.basicInfo.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author zhangqingxi 2017-03-31
 */
@Service
public class DeviceServiceImpl implements DeviceService {

    private final DeviceMapper deviceMapper;

    @Autowired
    public DeviceServiceImpl(DeviceMapper deviceMapper) {
        this.deviceMapper = deviceMapper;
    }

    @Override
    public List<Device> findByParam(Map paramMap) {
        return deviceMapper.findByParam(paramMap);
    }

    @Override
    public List<Map> findAllByDeptId(String deptId) {
        return deviceMapper.findAllByDeptId(deptId);
    }

    @Override
    public Integer findByParamCount(Map paramMap) {
        return deviceMapper.findByParamCount(paramMap);
    }

    @Override
    public Device findById(String id) {
        return deviceMapper.findById(id);
    }

    @Transactional
    @Override
    public Integer add(Map paramMap) {
        return deviceMapper.add(paramMap);
    }

    @Transactional
    @Override
    public Integer updateById(Map paramMap) {
        return deviceMapper.updateById(paramMap);
    }


}
